package com.vichat.workflow.service;

import com.vichat.common.vo.PageFilter;
import com.vichat.workflow.entity.*;
import com.vichat.workflow.vo.WorkflowUser;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

/**
 * Created by wangluyin on 2018/5/21.
 */
public interface IWorkflowServcie {



    public InsWfNode getInsWfNodeById(long insNodeId);
    /**
     * 获取当前有效工作流程
     * @return
     */
    public List<Wf> getWorkflows(long partyId);

    /**
     * 根据流程编号获取工作流程
     * @param flowId
     * @return
     */
    public Wf getWorkflowById(long flowId);

    /**
     * 根据流程编码获取工作流程
     *
     * @param flowCode
     * @return
     */
    public Wf getWorkflowByFlowCode(String flowCode);


    /**
     * 根据流程编号获取所有流程节点信息
     * @param flowId
     * @return
     */
    public List<WfNode> getWfNodesByFlowId(long flowId);


    /**
     * 根据流程节点编号获取流程节点信息
     * @param nodeId
     * @return
     */
    public WfNode getWfNodeByNodeId(long nodeId);

    /**
     * 根据流程编号获取开始流程节点信息
     * @param flowId
     * @return
     */
    public WfNode getWfStartNode(long flowId);


    public List<WfNodeAttrFieldset> getAttrFieldsetByNodeId(long nodeId, long flowId) ;

    public List<WfNodeAttr> getAttrsByFieldsetId(long nodeId, long fieldsetId);


    public List<WfNodeAttr> getAttrsByNodeId(long nodeId);



    public InsWf startFlow(Wf wf, WfNode wfNode, Map<String, Object> models, WorkflowUser user) throws Exception;

    public InsWf commitFlow(long insNodeId, @RequestBody Map<String, Object> models, WorkflowUser user)throws Exception;

    public InsWf saveFlow(long insNodeId, @RequestBody Map<String, Object> models, WorkflowUser user)throws Exception;

    public InsWf backFlow(long insNodeId, String replyNote, WorkflowUser user)throws Exception;

    /**
     * 获取工作流节点信息
     * @param uId
     * @return
     * @throws Exception
     */
    public List<InsWfNode> getInsFlowNodesByPage(Long insFlowId, String insFlowDesc, Long partyId, Long createUid, Long uId, Long orgId, String roleIdList, String orgCode, String startTime, String endTime, String deadTime, Integer flowState, Integer nodeState, PageFilter pf)throws Exception;
    public BigInteger countInsFlowNodes(Long insFlowId, String insFlowDesc, Long partyId, Long createUid, Long uid, Long orgId, String roleIdList, String orgCode, String startTime, String endTime, String deadTime, Integer flowState, Integer nodeState) throws Exception ;

    public List<InsWf> getInsFlows(Long insFlowId, String insFlowDesc, Long createUid, Long dealUid,String startTime, String endTime, Long flowState,Long nodeState, String orgCode, PageFilter pf)throws Exception;
    public BigInteger countInsFlows(Long insFlowId, String insFlowDesc, Long createUid,Long dealUid, String startTime, String endTime, Long flowState,Long nodeState, String orgCode)throws Exception;

    public List<InsWfNode> getInsNodesByInsFlowId(long insFlowId)throws Exception;

    public InsWfNodeAttr getInsNodeAttr(long insFlowId, long insNodeId, String attrCode);

    public List<WfSchedule> getAutoTodoWfSchedule(int rows);
    public void processWfSchedule(WfSchedule wfSchedule) throws Exception;

    public WfTempResource saveWfTempResource(WfTempResource wfTempResource, String cfgCode) throws Exception;

    public List<WfResource> getWfResources(long insFlowId, long insNodeId, String attrCode);

    public InsWfNode transferDealUser(InsWfNode insWfNode, Long agentUid)throws Exception;
    public InsWf getInsFlowById(Long insWfId)throws Exception;

    public InsWf updateInsWfAttr(long insFlowId, String attr1)throws Exception;
}
